<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>显示学生进度</title>
    <!-- Bootstrap -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="css/bootstrap-table.css" rel="stylesheet"/>
    <link href="css/bootstrap-select.min.css" rel="stylesheet"/>
    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        body {
            padding-top: 40px;
            padding-bottom: 40px;
            background-color: #eee;
        }

        .form-signin {
            max-width: 330px;
            padding: 15px;
            margin: 0 auto;
        }

        .form-signin .form-signin-heading,
        .form-signin {
            margin-bottom: 10px;
        }


        .form-signin .form-control {
            position: relative;
            height: auto;
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            box-sizing: border-box;
            padding: 10px;
            font-size: 16px;
        }
        .form-signin .form-control:focus {
            z-index: 2;
        }


    </style>
</head>
<body>

<div class="container">

    <form class="form-signin" method="post" action="/rsm/schedule/addSchedule.do">
        <h2 class="form-signin-heading">请选择你的学习进度</h2>
        <br>
        <label for="inputEmail" class="sr-only">姓名</label>
        <input type="xsname" id="inputEmail" class="form-control" name="xsName" disabled>
        <br>
        <select id="slpk" class="selectpicker" name="ids"></select>
        <br>
        <br>
        <div class="form-group">
            <label>关于学习有什么想法和问题？</label>
            <textarea class="form-control" rows="3" name="suggest"></textarea>
        </div>
        <br>
        <button class="btn btn-lg btn-primary btn-block" type="submit">提交</button>
    </form>

</div> <!-- /container -->



<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
<script src="js/jquery-3.3.1.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="js/bootstrap.min.js"></script>
<script src="js/bootstrap-table.js"></script>
<script src="js/bootstrap-table-zh-CN.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script>
    $(function() {

        $.ajax({
            url: '/rsm/user/getUserName.do',
            async: false,
            type: "get",
            dataType:'json',
            success: function (data) {
                $("#inputEmail").prop("placeholder",data)
            }
        });

        $(".selectpicker").selectpicker({
            noneSelectedText : '请选择'
        });

        $(window).on('load', function() {
            $('.selectpicker').selectpicker('val', '');
            $('.selectpicker').selectpicker('refresh');
        });

        //下拉数据加载
        $.ajax({
            type : 'get',
            url : "/rsm/schedule/showall.do",
            dataType : 'json',
            success : function(datas) {//返回list数据并循环获取
                var select = $("#slpk");
                for (var i = 0; i < datas.length; i++) {
                    select.append("<option value='"+datas[i].sid+"'>"
                        + datas[i].sname + "</option>");
                }
//                获取学生之前的进度信息做回显
                $.ajax({
                    url: '/rsm/schedule/getSchedule.do',
                    async: false,
                    type: "get",
                    dataType:'json',
                    success: function (data) {
                        $('.selectpicker').selectpicker('val', data);
                    }
                });

                $('.selectpicker').selectpicker('refresh');
            }
        });
    });
</script>
</body>
</html>
